from tools_algorithm import *


class Solution:
    def resultsArray(self, nums: List[int], k: int) -> List[int]:
        ans = []
        c = 1
        for i, v in enumerate(nums):
            if i > 0:
                if v == nums[i - 1] + 1:
                    c += 1
                else:
                    c = 1
            if i >= k - 1:
                if c == k:
                    ans.append(v)
                    c = k - 1
                else:
                    ans.append(-1)

        return ans
